import uuid
import model

def create_rule(rule):
    id = uuid.uuid4()  
    return model.Rule(id, rule.name, rule.points, rule.year, rule.month)

def create_rule_spec(rs):
    id = uuid.uuid4()    
    elements = [model.RuleSpecElement(x) for x in rs.elements]
    rsModel = model.RuleSpec(id, rs.f, rs.t, rs.amount, rs.year, rs.month, rs.type)
    rsModel.elements = elements
    return rsModel